'use strict';
var _dataapiUrl = 'http://appapi.17house.com/ZnbjApi.php?action=znbjCalculator&callback=?';
var _dataapiUrl_1 = 'http://appapi.17house.com/ZnbjApi.php?action=getIp&callback=?';
var _city = '北京';
$.ajax({
	url: _dataapiUrl_1,
	type: 'POST',
	//data:null,
	dataType: 'jsonp',
	success: function(data) {

		if(data.error == 0) {
			_city = data.city;
			$("#source1").val(_city);
			$("#source2").val(_city);
			yuyueliangfangDesign.selectText();
		}
	}
});
var yuyueliangfangDesign = {
	gC: function(ckName) {
		if(document.cookie.length > 0) {
			var begin = document.cookie.indexOf(ckName + "=");
			if(begin != -1) {
				begin += ckName.length + 1;
				end = document.cookie.indexOf(";", begin);
				if(end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(begin, end));
			}
		}
		return null;
	},
	init: function() {
		$('.ipt-submit3').click(function(e) {
			var evt = e ? e : window.event;
			evt.stopPropagation();
			var name = $('#byName').val();
			var phone = $('#byTel').val();
			var regTest =
				/^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/;
			if(!name.length || name == '请填写您的姓名') {
				alert('您的称呼不能为空！');
				return false;
			}
			if(!phone.length || phone == '您的电话') {
				alert('您的电话不能为空！');
				return false;
			}
			if(!regTest.test(phone)) {
				alert('您的电话格式不对！');
				return false;
			}
			/*获取URL参数方法*/
			var GetQueryString = function(arg) {
				/*定义正则，用于获取相应参数*/
				var reg = new RegExp("(^|&)" + arg + "=([^&]*)(&|$)");
				/*字符串截取，获取匹配参数值*/
				var r = window.location.search.substr(1).match(reg);
				/*返回参数值*/
				if(r != null) {
					return decodeURI(r[2]);
				}

				return null;
			};
			var getCookie = function(ckName) {
				if(document.cookie.length > 0) {
					var begin = document.cookie.indexOf(ckName + "=");
					if(begin != -1) {
						begin += ckName.length + 1;
						var end = document.cookie.indexOf(";", begin);
						if(end == -1) end = document.cookie.length;
						return decodeURIComponent(document.cookie.substring(begin, end));
					}
				}
				return null;
			};
			var $data = {},
				cF = "SEM",
				her = document.location.href,
				cy = /shanghai/,
				cS = $("#position").val(),
				GJ = $("#position_name").val(),
				da = $("#position_name").val();
			var semZhi = GetQueryString("channel");
			switch(semZhi) {
				case "sembaidu":
					cS = "百度-PC";
					break;
				case "semsougou":
					cS = "搜狗-PC";
					break;
				case "sem360":
					cS = "360-PC";
					break;
				case "semsm":
					cS = "神马-PC";
					break;
				case "semdsp":
					cS = "DSP-PC";
					break;
			};
			if(cy.test(her)) {
				da = "SEM上海-" + GJ;
			}

			$data.mobile = $("#byTel").val();
			$data.name = $("#byName").val();
			$data.cityName = $("#source1").val();
			$data.referrerSecond = document.location.href;
			$data.referrerFirst = yuyueliangfangDesign.gC('userMail') || document.referrer;
			$data.smsType = 1;
			$data.zxdate = "";
			$data.square = "";
			$data.community = "";
			$data.channelFirst = cF;
			$data.channelSecond = cS;
			$data.channelKey = GJ;
			$data.semId = semId;
			setTimeout(function() {
				var urlreferer = document.referrer || window.location.href;
				var urlReg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
				var refurl = urlReg.exec(urlreferer);
				var urldomain = refurl[0];
				var userinfo = encodeURIComponent(da) + '----' + encodeURIComponent($("#byName").val()) + '----' + $(
					"#byTel").val(); //这里需要拼上用户填写报名的手机和用户名
				var staturl = 'http://stat.17house.com/stat.js?site=pc&housetype=jzsem&houseyewu=baoming&urlreferer=' +
					urlreferer + '&userinfo=' + userinfo + '&urldomain=' + urldomain + '&t=' + new Date().getTime();
				$.get(staturl);
			}, 2);
			$.ajax({
				type: 'POST',
				data: $data,
				url: 'http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?',
				dataType: "json",
				success: function(data) {
					if(data.error == 0) {
						// new popLayer($('.pop-bm-sucess'));
						$("#biao_yuyue").css("display", "none");
						$(".aftersucc").css("display", "block");
						yuyueliangfangDesign.PullSwiperData();
						/*增加3s跳转*/
						//						setTimeout(function(){
						//							location.href="http://www.17house.com";
						//						},3000);
					} else {
						alert('报名失败');
					}
				}

			})
		});
		//小表格
		$('.ipt-submit2').click(function(e) {
			var evt = e ? e : window.event;
			evt.stopPropagation();
			var name = $('#byName2').val();
			var phone = $('#byTel2').val();
			var regTest =
				/^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/;
			if(!name.length || name == '请输入您的姓名') {
				alert('您的称呼不能为空！');
				return false;
			}
			if(!phone.length || phone == '您的电话') {
				alert('您的电话不能为空！');
				return false;
			}
			if(!regTest.test(phone)) {
				alert('您的电话格式不对！');
				return false;
			}
			//提交的数据

			/*获取URL参数方法*/
			var GetQueryString = function(arg) {
				/*定义正则，用于获取相应参数*/
				var reg = new RegExp("(^|&)" + arg + "=([^&]*)(&|$)");
				/*字符串截取，获取匹配参数值*/
				var r = window.location.search.substr(1).match(reg);
				/*返回参数值*/
				if(r != null) {
					return decodeURI(r[2]);
				}

				return null;
			};
			var $data = {},
				cF = "SEM",
				her = location.href,
				cy = /shanghai/,
				cS = $("#position").val(),
				GJ = $("#tit").html(),
				da = ""; /*$("#position_name").val()*/
			var semZhi = GetQueryString("channel");
			switch(semZhi) {
				case "sembaidu":
					cS = "百度-PC";
					break;
				case "semsougou":
					cS = "搜狗-PC";
					break;
				case "sem360":
					cS = "360-PC";
					break;
				case "semsm":
					cS = "神马-PC";
					break;
				case "semdsp":
					cS = "DSP-PC";
					break;
			};
			$data.mobile = $("#byTel2").val();
			$data.name = $("#byName2").val();
			$data.cityName = $("#source1").val();
			$data.referrerSecond = document.location.href;
			$data.referrerFirst = yuyueliangfangDesign.gC('userMail') || document.referrer;
			$data.smsType = "1";
			$data.zxdate = "",
				$data.square = "",
				$data.community = "";
			if(cy.test(her)) {
				da = "SEM上海-" + GJ;
			}
			$data.channelFirst = cF;
			$data.channelSecond = cS;
			$data.channelKey = GJ;
			$data.semId = semId;
			var urlreferer = document.referrer || window.location.href;
			var urlReg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
			var refurl = urlReg.exec(urlreferer);
			var urldomain = refurl[0];
			var userinfo = encodeURIComponent(da) + '----' + encodeURIComponent($("#byName2").val()) + '----' + $(
				"#byTel2").val(); //这里需要拼上用户填写报名的手机和用户名
			var staturl = 'http://stat.17house.com/stat.js?site=pc&housetype=jzsem&houseyewu=baoming&urlreferer=' +
				urlreferer + '&userinfo=' + userinfo + '&urldomain=' + urldomain + '&t=' + new Date().getTime();
			$.get(staturl);

			$.ajax({
				type: 'POST',
				data: $data,
				url: 'http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?',
				dataType: "json",
				success: function(data) {
					if(data.error == 0) {
						//						$("#biao_d").css("display", "block");
						//						$(".aftersucc").css("display", "block");
						//						$("#Hui").css("display", "block");
						//						yuyueliangfangDesign.PullSwiperData();
						popup_rvideo2("免费设计方案");
					} else {
						alert('报名失败');
					}
				} //end success

			}) // end ajax
		});
		//小表格End
	},

	Top: function() {
		//alert(window.screen.availHeight);
		var top = 0,
			height = window.screen.availHeight; /*原生方法*/
		$("#biao_d").css("height", height);
		$("#Hui").css("height", height);
	},
	Close: function() {
		$(".close").on("click", function(e) {
			var evt = e ? e : window.event;
			evt.stopPropagation();
			$("#biao_d").css("display", "none");
			$("#Hui").css("display", "none");
			$("#Er").css("display", "none");
			$("#biao_yuyue").css("display", "none");

		});
	},
	
	Tan: function() {
		$(".btn_data-tit").on("click", function(e) {
			var evt = e ? e : window.event;
			evt.stopPropagation();
			var Tit = $(this).attr("data-tit");
			Tit = Tit.split("-")[0];
			// 		alert($(this).attr("data-tit"));
			$("#tit").text(Tit);
			$("#position_name").val($(this).attr("data-tit"));
			//          $("#biao_d").css("display", "block");
			//          $("#biao_yuyue").css("display", "block");
			//          $("#Hui").css("display", "block");
			var target = $(e.target);
			if(target.closest(".show-block2").length == 0) {
				/* .closest()沿 DOM 树向上遍历，直到找到已应用选择器的一个匹配为止，返回包含零个或一个元素的 jQuery 对象。*/
				$(".show-block2").css("display", "none");
			};
		});
		$(".biaodan").on("click,", function(e) {
			var evt = e ? e : window.event;
			evt.stopPropagation();
		})
	},

	selectText: function() {
		/*问题 点击空白可以让*/
		$("#source1").focus(function(e) {
			$(document).unbind();
			var evt = e ? e : window.event;
			evt.stopPropagation();
			$(this).addClass("active");
			$(".show-block1").slideDown();
		}).blur(function() {
			$(document).bind("click", function(e) {
				var target = $(e.target);
				if(target.closest(".show-block1").length == 0) {
					/* .closest()沿 DOM 树向上遍历，直到找到已应用选择器的一个匹配为止，返回包含零个或一个元素的 jQuery 对象。*/
					$(".show-block1").css("display", "none");
				};
				e.stopPropagation();
			});
		});
		$("#source2").focus(function(e) {
			$(document).unbind();
			var evt = e ? e : window.event;
			evt.stopPropagation();
			$(this).addClass("active");
			$(".show-block2").slideDown();
		}).blur(function() {
			$(document).bind("click", function(e) {
				var target = $(e.target);
				if(target.closest(".show-block2").length == 0) {
					/* .closest()沿 DOM 树向上遍历，直到找到已应用选择器的一个匹配为止，返回包含零个或一个元素的 jQuery 对象。*/
					$(".show-block2").css("display", "none");
				};
				e.stopPropagation();
			});
		});
		$(".show-block ul li").on("click", function() {

			$(".selected input").val($(this).html());
			$(this).parent().parent().hide();
			$(this).parent().parent().prev().removeClass("active");
		});
	},
	Hover_list: function() {
		//"mouseenter mouseleave"
		$(".list_img").on("mouseenter", ".list_li", function() {
			$(this).find(".li2").addClass("li2_on");
			$(this).find("p").css("display", "block");
		})
		$(".list_img").on("mouseleave", ".list_li", function() {
			//setInterval("",200);
			$(this).find(".li2").removeClass("li2_on");
			$(this).find("p").css("display", "none");
		});
	},
	log: function() {

	},
	NewSuccessDom: function() {
		var html =
			'<div class="aftersucc">\
			<p class="TK_succ_close"><img src="http://s1.17house.com/common/Succ_baom/common/images/TK_close.png" alt="关闭按钮" class="img_close"></p>\
			<p class="TK_succ_TrueImg"><img src="http://s1.17house.com/newweb/pc/common/images/greentrue.png" /></p>\
			<p class="TK_succ_title">恭喜您预约成功！</p>\
			<p class="TK_succ_smtitle">稍后装修管家会与您致电,了解您的具体装修需求,请保持电话畅通,谢谢!</p>\
			<ul class="TK_succ_Aul clearfix">\
				<li class="l ml30 mr5"><i class="i1"></i></li>\
				<li class="l"><span>8年服务800万</span></li>\
				<li class="l Aul-thirdLi mr5"><i class="i2"></i></li>\
				<li class="l"><span>上市互联网装修平台</span></li>\
			</ul>\
		</div>';
		$("body").append(html);
		$(".aftersucc .TK_succ_close").on("click", function(e) {
			var evt = e ? e : window.event;
			evt.stopPropagation();
			$("#biao_d").css("display", "none");
			$("#Hui").css("display", "none");
			$(".aftersucc").css("display", "none");
			$("#biao_yuyue").css("display", "none");
			$('.popmask').hide();
		});
	},
	PullSwiperData: function() {
		$(".aftersucc .TK_succ_swiperBox").remove();
		$.ajax({
			type: "GET",
			url: "http://cms.17house.com/adsApi/getByPid?pid=210&limit=10",
			dataType: "jsonp",
			timeout: 0,
			contentType: "application/json;utf-8",
			success: function(data) {
				console.log(data);
				var html = '';
				html += '<div class="TK_succ_swiperBox swiper-container" >';
				html += '<div class="swiper-wrapper">';
				$.each(data.data, function(i, val) {
					html += '<div class="swiper-slide">\
							<a href="' + val.url + '" title="' + val.name +
						'">\
								<img class="img" src="' + val.path + '" alt="' + val.name +
						'" />\
							</a>\
						</div>';
				})
				html += '</div>';
				html += '<div class="TK_succ_swiperBox_pagination pagination"></div></div>';
				html += '</div>';
				$(".aftersucc .TK_succ_Aul").after(html);
				var swiperFn2 = function() {
					var mySwiper = new Swiper('.TK_succ_swiperBox', {
						slidesPerView: "auto",
						autoplay: 2000, //可选选项，自动滑动
						loop: true,
						centeredSlides: true,
						pagination: '.TK_succ_swiperBox_pagination',
						paginationClickable: true,
						autoplayDisableOnInteraction: false
					});
				};
				swiperFn2();
			},
			error: function(data) {
				console.log(data);
			}
		});
	},
	pop_upinit: function(ckname, Phone, City, tit2,type) {
		event.stopPropagation();
		var name = $('#baom_name').val();
		var phone = Phone;
		var cityname = City;
		var sqarea = $("#baom_area").val()
		var regTest =
			/^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/;
		if(!phone.length || phone == '您的电话') {
			alert('您的电话不能为空！');
			return false;
		}
		if(!regTest.test(phone)) {
			alert('您的电话格式不对！');
			return false;
		}
		/*获取URL参数方法*/
		var GetQueryString = function(arg) {
			/*定义正则，用于获取相应参数*/
			var reg = new RegExp("(^|&)" + arg + "=([^&]*)(&|$)");
			/*字符串截取，获取匹配参数值*/
			var r = window.location.search.substr(1).match(reg);
			/*返回参数值*/
			if(r != null) {
				return decodeURI(r[2]);
			}

			return null;
		};

		var getCookie = function(ckName) {
			if(document.cookie.length > 0) {
				var begin = document.cookie.indexOf(ckName + "=");
				if(begin != -1) {
					begin += ckName.length + 1;
					var end = document.cookie.indexOf(";", begin);
					if(end == -1) end = document.cookie.length;
					return decodeURIComponent(document.cookie.substring(begin, end));
				}
			}
			return null;
		};
		var $data = {},
			cF = "SEM",
			her = document.location.href,
			cy = /shanghai/,
			cS = $("#position").val(),
			GJ = "baom-" + ckname,//$("#position_name").val()
			da = "baom-" + ckname;
		var semZhi = GetQueryString("channel");
		switch(semZhi) {
			case "sembaidu":
				cS = "百度-PC";
				break;
			case "semsougou":
				cS = "搜狗-PC";
				break;
			case "sem360":
				cS = "360-PC";
				break;
			case "semsm":
				cS = "神马-PC";
				break;
			case "semdsp":
				cS = "DSP-PC";
				break;
		};
		if(cy.test(her)) {
			da = "SEM上海-" + GJ;
		}

		$data.mobile = Phone;
		$data.name = $("#baom_name").val();
		$data.cityName = City;
		$data.referrerSecond = document.location.href;
		$data.referrerFirst = yuyueliangfangDesign.gC('userMail') || document.referrer;
		$data.smsType = type;
		$data.zxdate = "";
		$data.square = sqarea;
		$data.community = "";
		$data.channelFirst = cF;
		$data.channelSecond = cS;
		$data.channelKey = "baom-" + ckname;
		$data.semId = semId;
		window.sessionStorage.setItem("baojiaArr",JSON.stringify($data));
		setTimeout(function() {
			var urlreferer = document.referrer || window.location.href;
			var urlReg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
			var refurl = urlReg.exec(urlreferer);
			var urldomain = refurl[0];
			var userinfo = encodeURIComponent(da) + '----' + encodeURIComponent($("#baom_name").val()) + '----' + Phone; //这里需要拼上用户填写报名的手机和用户名
			var staturl = 'http://stat.17house.com/stat.js?site=pc&housetype=jzsem&houseyewu=baoming&urlreferer=' +
				urlreferer + '&userinfo=' + userinfo + '&urldomain=' + urldomain + '&t=' + new Date().getTime();
			$.get(staturl);
		}, 2);
		$.ajax({
			type: 'POST',
			data: $data,
			url: 'http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?',
			dataType: "json",
			success: function(data) {
				console.log(data)
				if(data.error == 0) {
					//						alert("成功");
					popup_rvideo2(tit2)
				} else {
					alert('报名失败');
				}
			}

		})
	},
	pop_baojia: function(ckname, Phone, Area, City, tit2,type) {
		event.preventDefault(); //阻止表单提交事件
		console.log($("#sheji_shenqing").parent().find(".error-tip").html())
		$('.error-tip').html('');
		//表单验证
		var square = Area;
		var phone = Phone;
		var cityname = City;

		//		var User_Shen = $(this).find('select[name=User_Shen]');
		//		var User_City = $(this).find('select[name=User_City]');
		var keyword = $('#kword').attr('data-keyword');

		//面积验证
		if(!yuyueliangfangDesign.checkSquare($("#sheji_shenqing").parent(), square)) {
			return false;
		}

		//手机号验证
		if(!yuyueliangfangDesign.checkPhone($("#sheji_shenqing").parent(), phone)) {
			return false;
		}
		/*获取URL参数方法*/
		var GetQueryString = function(arg) {
			/*定义正则，用于获取相应参数*/
			var reg = new RegExp("(^|&)" + arg + "=([^&]*)(&|$)");
			/*字符串截取，获取匹配参数值*/
			var r = window.location.search.substr(1).match(reg);
			/*返回参数值*/
			if(r != null) {
				return decodeURI(r[2]);
			}

			return null;
		};
		var $data = {},
			cF = "SEM",
			her = location.href,
			cy = /shanghai/,
			cS = $("#position").val(),
			GJ = "baom-" + ckname,		//'获取报价-' + $("#position_name").val(),
			da = "baom-" + ckname; 		/*sacfsf*/
		var semZhi = GetQueryString("channel");
		switch(semZhi) {
			case "sembaidu":
				cS = "百度-PC";
				break;
			case "semsougou":
				cS = "搜狗-PC";
				break;
			case "sem360":
				cS = "360-PC";
				break;
			case "semsm":
				cS = "神马-PC";
				break;
			case "semdsp":
				cS = "DSP-PC";
				break;
		};
		$data.mobile = phone.val();
		$data.name = "匿名";
		$data.cityName = cityname.val();
		$data.referrerSecond = document.location.href;
		$data.referrerFirst = yuyueliangfangDesign.gC('userMail') || document.referrer;
		$data.smsType = type;
		$data.zxdate = "",
		$data.square = square.val(),
		$data.community = "";
		if(cy.test(her)) {
			da = "SEM上海-" + GJ;
		}
		$data.channelFirst = cF;
		$data.channelSecond = cS;
		$data.channelKey = "baom-" + ckname;
		$data.semId = semId;
		window.sessionStorage.setItem("baojiaArr",JSON.stringify($data));
		var urlreferer = document.referrer || window.location.href;
		var urlReg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
		var refurl = urlReg.exec(urlreferer);
		var urldomain = refurl[0];
		var userinfo = encodeURIComponent(da) + "---" + encodeURIComponent('城市：') + cityname.val() + '---' +
			encodeURIComponent('手机号码：') + phone.val() + '---' + encodeURIComponent('面积：') + square.val(); //这里需要拼上用户填写报名的手机和用户名
		var staturl = 'http://stat.17house.com/stat.js?site=pc&housetype=jzsem&houseyewu=baoming&urlreferer=' +
			urlreferer + '&userinfo=' + userinfo + '&urldomain=' + urldomain + '&t=' + new Date().getTime();
		$.get(staturl);
		$.ajax({
			type: 'POST',
			data: $data,
			url: 'http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?',
			dataType: "json",
			success: function(data) {
				if(data.error == 0) {

					//新弹框
					popup_rbudget2(tit2)

				} else {
					new popLayer($('.pop-bm-sucess')); //弹窗:重复报名
					/*增加3s跳转*/
					//						setTimeout(function(){
					//							location.href="http://www.17house.com";
					//						},3000);
				}
			} //end success

		}) // end ajax
		/*数据监控  end*/
	},
	/*验证手机号*/
	checkPhone: function(parent, phone) {
		if(phone.val() == '' || phone.val() == phone.attr('data-value')) {
			parent.find('.error-tip').html('请填写手机号');
			phone.focus();
			return false;
		}

		var regTest =
			/^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/;
		if(!regTest.test(phone.val())) {
			parent.find('.error-tip').html('电话格式不对，请检查');
			phone.focus();
			return false;
		}
		return true;
	},

	/*验证面积*/
	checkSquare: function(parent, square) {
		if(square.val() == '' || square.val() == square.attr('data-value')) {
			parent.find('.error-tip').html('请填写建筑面积');
			square.focus();
			return false;
		}
		var regTest = /[0-9]$/;
		if(!regTest.test(square.val())) {
			parent.find('.error-tip').html('建筑面积: 请填写数字');
			square.focus();
			return false;
		}
		return true;
	},
	pop_up: function(upname) {
		if(upname == ".pop_up2") {
			popup_rimg(".pop_up2", "http://s1.17house.com/newweb/m/newSem/1140/img/banner.png", "免费获取设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up4") {
			popup_rbudget1(".pop_up4", "免费设计方案","3")
		} else if(upname == ".pop_up5") {
			popup_rimg(".pop_up5", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_5.png", "申请免费上门量房", "免费上门量房","获免费量房","1");
		} else if(upname == ".pop_up6") {
			popup_rimg(".pop_up6", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_6.png", "申请0利息装修贷款", "装修贷款资格","获0利率贷款","6");
		} else if(upname == ".pop_up7") {
			popup_rimg(".pop_up7", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_7.png", "申请老房免费设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up8") {
			popup_rimg(".pop_up8", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_8.png", "申请婚房免费设计方案 ", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up9") {
			popup_rimg(".pop_up9", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_9.png", "申请新房免费设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up10") {
			popup_rimg(".pop_up10", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_10.png", "申请复式免费设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up11") {
			popup_rimg(".pop_up11", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_11.png", "申请别墅免费设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up12") {
			popup_rimg(".pop_up12", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_12.png", "申请商业装修免费设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up13") {
			popup_rimg(".pop_up13", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_13.png", "算算装修成这样要花多少钱", "免费设计方案","接受报价明细","3");
		} else if(upname == ".pop_up14") {
			popup_rimg(".pop_up14", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_14.png", "申请免费设计方案", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up15") {
			popup_rimg(".pop_up15", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_15.png", "免费预约人气设计师", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up16") {
			popup_rimg(".pop_up16", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_16.png", "免费预约人气设计师", "免费设计方案","获免费设计方案","1");
		} else if(upname == ".pop_up17") {
			popup_rimg(".pop_up17", "http://s1.17house.com/newweb/m/newSem/1140/img/baom_17.png", "预约现场看工地", "配置合适的工地","预约看工地","11");
		} else if(upname == ".pop_up18") {
			popup_rvideo1(".pop_up18", "免费体验整体家装服务", "免费设计方案","1");
		}
	},
	close: function() {
		$("#baom_close").on("click", function() {
			$("#baom-sheji_wrapper").css("display", "none");
			$("#baom-sheji_wrapper").html("");
		});
	},
	playvideo: function() {
		$(".baom_videoimg").click(function() {
			$(this).css("display", "none");
			var videoPlay = $('#baom_video')[0];
			videoPlay.play();
		})
	},

};
yuyueliangfangDesign.init();
yuyueliangfangDesign.Top();
yuyueliangfangDesign.selectText();
yuyueliangfangDesign.Hover_list();
yuyueliangfangDesign.NewSuccessDom();
//yuyueliangfangDesign.Close();
//yuyueliangfangDesign.Tan();

//新的
yuyueliangfangDesign.pop_up(".pop_up1");
yuyueliangfangDesign.pop_up(".pop_up2");
yuyueliangfangDesign.pop_up(".pop_up4");
yuyueliangfangDesign.pop_up(".pop_up5");
yuyueliangfangDesign.pop_up(".pop_up6");
yuyueliangfangDesign.pop_up(".pop_up7");
yuyueliangfangDesign.pop_up(".pop_up8");
yuyueliangfangDesign.pop_up(".pop_up9");
yuyueliangfangDesign.pop_up(".pop_up10");
yuyueliangfangDesign.pop_up(".pop_up11");
yuyueliangfangDesign.pop_up(".pop_up12");
yuyueliangfangDesign.pop_up(".pop_up13");
yuyueliangfangDesign.pop_up(".pop_up14");
yuyueliangfangDesign.pop_up(".pop_up15");
yuyueliangfangDesign.pop_up(".pop_up16");
yuyueliangfangDesign.pop_up(".pop_up17");
yuyueliangfangDesign.pop_up(".pop_up18");

function popup_rimg(cla, img, tit, tit2,place,type) {
	$(cla).on("click", function() {
		//关键词
		var ckname = $(this).context.dataset.ckname;
		//对应的图片
		var oimg = $(this).context.dataset.img;
		var rimg;
		//如果没有对应的图片就
		if(oimg != undefined) {
			rimg = oimg
		} else {
			rimg = img
		}
		var wrapperhtml = '<div id="baom-sheji" class="baoming"><!--左边--><div id="baom-freesheji_left"><div class="baom_free_tit">' + tit + '</div><div class="baom_free_apply">已有&nbsp;&nbsp;<span>4</span>&nbsp;<span>2</span>&nbsp;<span>8</span>&nbsp;<span>1</span>&nbsp;&nbsp;人申请</div><div class="baom_free_city"><img class="baom_free_cityimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/city.png"/><select class="baom_free_citylist"><option value="请选择城市">请选择城市</option></select></div><input type="hidden" value="匿名" id="baom_name"/><!--m面积--><div class="baom_free_area" style="display:none"><img class="baom_free_areaimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/area_03.png"/><input class="baom_free_areatext" type="text" name="" id="baom_area" value="" placeholder=""/><span class="baom_free_sqm">m²</span></div><div class="baom_free_phone"><img class="baom_free_phoneimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/phone.png"/><input class="baom_free_phonetext" type="text" name="" id="baom_phone" value="" maxlength="11" placeholder="输入手机号，'+place+'"/></div><div class="baom_free_btnbox"><p class="error-tip"></p><button class="baom_free_btn" id="sheji_shenqing">立即申请</button></div><div class="baom_free_fottext"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/dun.png"/> &nbsp;互联网装修上市企业 9年服务客户800万</div></div><!--右边--><div id="baom-freesheji_right"><img src="' + rimg + '"/></div><!--关闭--><div id="baom_close"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/close.png"/></div></div>'
		$("#baom-sheji_wrapper").html(wrapperhtml);
		$("#baom-sheji_wrapper").css("display", "block");
		$("#sheji_shenqing").click(function() {
			if(cla != ".pop_up13") {
				var phone = $('#baom_phone').val();
				var cityname = $('.baom_free_citylist').val();
				yuyueliangfangDesign.pop_upinit(ckname, phone, cityname, tit2,type)
			} else {
				var phone = $('#baom_phone');
				var areaname = $('#baom_area');
				var city = $('.baom_free_citylist');
				yuyueliangfangDesign.pop_baojia(ckname, phone, areaname, city,tit2,type)
			}
		})
		//随机人数
		apply_people()
		//面积
		default_area()
		//城市列表
		citylists();
		//关闭窗口
		yuyueliangfangDesign.close();
	});
}
//左边申请右边视频
function popup_rvideo1(cla, tit, tit2,type) {
	$(cla).on("click", function() {
		console.log($(this).context.dataset.ckname)
		var ckname = $(this).context.dataset.ckname
		var wrapperhtml = '<div id="baom-sheji" class="baoming"><!--左边--><div id=baom-freesheji_left><div class=baom_free_tit>'+tit+'</div><div class=baom_free_apply>已有&nbsp;&nbsp;<span>4</span>&nbsp;<span>2</span>&nbsp;<span>8</span>&nbsp;<span>1</span>&nbsp;&nbsp;人申请</div><div class=baom_free_city><img class=baom_free_cityimg src=http://s1.17house.com/newweb/m/newSem/1140/img/city.png><select class=baom_free_citylist><option value="请选择城市">请选择城市</option></select></div><input type="hidden" value="匿名" id="baom_name"/><div class=baom_free_phone><img class=baom_free_phoneimg src=http://s1.17house.com/newweb/m/newSem/1140/img/phone.png><input class=baom_free_phonetext type=text name="" id="baom_phone" value="" maxlength="11"  placeholder="输入手机号，获免费设计方案"></div><div class="baom_free_btnbox"><p class="error-tip"></p><button class="baom_free_btn" id="sheji_shenqing">立即申请</button></div><div class="baom_free_fottext"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/dun.png"/>&nbsp;互联网装修上市企业 9年服务客户800万</div></div><!--右边--><div id="baom-sheji_right"><img class="baom_videoimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_banner.jpg"/><video width="443" height="239" controls id="baom_video"  > <source src="//static-default.17house.com/17housevedio/17housevedio.mp4" type="video/mp4"></source></video><h5 class="sheji_right_int">公司介绍</h5><p class="sheji_right_word">全国一站式装修服务平台，70%以上的客户来自口碑介绍，中国建筑装饰协会住宅委员会制定最具新兰的装修平台。目前已经<span class="word_color">北京、上海、深圳、武汉、成都、天津、西安、哈尔滨等</span>16个城市开设分公司和体验店。为全国49个主要大中型城市业主提供服务。2017年2月，成功挂牌新三板，成为上市的互联网装修服务平台。证券代码：870343（一起网）</p><ul class="sheji_right_list"><li><div class="sheji_right_list_left"><h5>2009年</h5><p>成立时间</p></div></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>中国北京</h5><p>成立地点</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>家装服务</h5><p>主营服务</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>120W人</h5><p>正在访问</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><div class="sheji_right_list_right"><h5>800W人</h5><p>累计服务</p></div></li></ul></div><!--关闭--><div id="baom_close"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/close.png"/></div></div>'
		$("#baom-sheji_wrapper").html(wrapperhtml);
		$("#baom-sheji_wrapper").css("display", "block");

		$("#sheji_shenqing").click(function() {
			var phone = $('#baom_phone').val();
			var cityname = $('.baom_free_citylist').val();
			yuyueliangfangDesign.pop_upinit(ckname, phone, cityname, tit2,type)

		})
		//随机人数
		apply_people()
		//城市列表
		citylists();
		//播放视频
		yuyueliangfangDesign.playvideo();
		//关闭窗口
		yuyueliangfangDesign.close();
	});
}
//左边设计方案右边视频2
function popup_rvideo2(tit2) {
	//	$(cla).on("click", function() {
	var wrapperhtml = '<div id="baom-sheji" class="baoming"><!--左边--><div id="baom-sheji_left"><div class="sheji_left_head"><h2>完善信息获得 <span class="word_color">' + tit2 + '</span></h2><p class="word_min"><span class="word_color">*</span>由于当前申请人数较多，完善资料将得到优先服务</p></div><div class="sheji_left_content"><!--1--><div class="one"><h6 class="sheji_left_word">1.您家的房屋现状是：</h6><div class="sheji_left_houseradio"><div class="sheji_left_one"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_img1.jpg"/><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/><span>毛呸房</span></p></div><div class="sheji_left_one"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_img2.jpg"/><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/><span>旧房翻新</span></p></div> <div class="sheji_left_one"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_img3.jpg"/><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/><span>局邮改造</span></p></div></div></div><!--2--><div class="two"><h6 class="sheji_left_word">2.您家准备什么时候开始装修：</h6><div class="sheji_left_timeradio"><div class="sheji_left_two"><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/>一个月内</p></div><div class="sheji_left_two"><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/>两个月内</p></div><div class="sheji_left_two"><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/>两个月以上</p></div></div></div><div class="three"><h6 class="sheji_left_word">3.您家小区的名称：<input type="text" placeholder="一起装修网将为您推荐优秀服务"/></h6></div><button class="sheji_left_btn" id="sheji_tijiao">提交</button></div></div><!--右边--><div id="baom-sheji_right"><img class="baom_videoimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_banner.jpg"/><video width="443" height="239" controls id="baom_video"> <source src="//static-default.17house.com/17housevedio/17housevedio.mp4" type="video/mp4"></source></video><h5 class="sheji_right_int">公司介绍</h5><p class="sheji_right_word">全国一站式装修服务平台，70%以上的客户来自口碑介绍，中国建筑装饰协会住宅委员会制定最具新兰的装修平台。目前已经<span class="word_color">北京、上海、深圳、武汉、成都、天津、西安、哈尔滨等</span>16个城市开设分公司和体验店。为全国49个主要大中型城市业主提供服务。2017年2月，成功挂牌新三板，成为上市的互联网装修服务平台。证券代码：870343（一起网）</p><ul class="sheji_right_list"><li><div class="sheji_right_list_left"><h5>2009年</h5><p>成立时间</p></div></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>中国北京</h5><p>成立地点</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>家装服务</h5><p>主营服务</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>120W人</h5><p>正在访问</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><div class="sheji_right_list_right"><h5>800W人</h5><p>累计服务</p></div></li></ul></div><!--关闭--><div id="baom_close"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/close.png"/></div></div>'
	$("#baom-sheji_wrapper").html(wrapperhtml);
	$("#baom-sheji_wrapper").css("display", "block");
	//报名提交
	$("#sheji_tijiao").click(function(){
		succeed()
	})
	//单选按钮
	radioimg();
	radiostart();
	//播放视频
	yuyueliangfangDesign.playvideo();
	//关闭窗口
	yuyueliangfangDesign.close();
	//	});
}
//左边成功右边视频3
function popup_rvideo3() {
		var wrapperhtml = '<div id="baom-sheji" class="baoming"><!--左边--><div id="baom-sheji_left_success"><div class="baom_success"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/success.png"/><p>申请成功！</p></div><div class="baom_text"><p><span class="word_color">*</span>15分钟后装修管家将以手机回电，为您提供免费咨询，敬请留意</p><p><span class="word_color">*</span>一起装修网提供<span class="word_color">免费量房-0元设计及VR实景方案-免费详细报价服务</span></p></div><img src="http://s1.17house.com/newweb/m/newSem/1140/img/QRcode.png"/></div><!--右边--><div id="baom-sheji_right"><img class="baom_videoimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_banner.jpg"/><video width="443" height="239" controls id="baom_video"> <source src="//static-default.17house.com/17housevedio/17housevedio.mp4" type="video/mp4"></source></video><h5 class="sheji_right_int">公司介绍</h5><p class="sheji_right_word">全国一站式装修服务平台，70%以上的客户来自口碑介绍，中国建筑装饰协会住宅委员会制定最具新兰的装修平台。目前已经<span class="word_color">北京、上海、深圳、武汉、成都、天津、西安、哈尔滨等</span>16个城市开设分公司和体验店。为全国49个主要大中型城市业主提供服务。2017年2月，成功挂牌新三板，成为上市的互联网装修服务平台。证券代码：870343（一起网）</p><ul class="sheji_right_list"><li><div class="sheji_right_list_left"><h5>2009年</h5><p>成立时间</p></div></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>中国北京</h5><p>成立地点</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>家装服务</h5><p>主营服务</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><h5>120W人</h5><p>正在访问</p></li><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/u1088.png"/></p><li><div class="sheji_right_list_right"><h5>800W人</h5><p>累计服务</p></div></li></ul></div><!--关闭--><div id="baom_close"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/close.png"/></div></div>'
		$("#baom-sheji_wrapper").html(wrapperhtml);
		$("#baom-sheji_wrapper").css("display", "block");
		//播放视频
		yuyueliangfangDesign.playvideo();
		//关闭窗口
		yuyueliangfangDesign.close();
}
//左边申请右边预算
function popup_rbudget1(cla,tit2,type) {
	$(cla).on("click", function() {
		console.log($(this).context.dataset.ckname)
		var ckname = $(this).context.dataset.ckname
		var wrapperhtml = '<div id="baom-sheji" class="baoming"><!--左边--><div id="baom-freesheji_left"><div class="baom_offer_tit">避免上当<span class="word_color">3秒估算装修报价</span></div><div class="baom_free_apply">已有&nbsp;&nbsp;<span>4</span>&nbsp;<span>2</span>&nbsp;<span>8</span>&nbsp;<span>1</span>&nbsp;&nbsp;人测算</div><!--che--><div class="baom_free_city" style="display:none"><img class="baom_free_cityimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/city.png"/><select class="baom_free_citylist"><option value="北京市">北京市</option></select></div><!--m面积--><div class="baom_free_area"><img class="baom_free_areaimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/area_03.png"/><input class="baom_free_areatext" type="text" id="baom_area" placeholder="建筑面积" /><span class="baom_free_sqm">m²</span></div><!--手机号--><div class="baom_free_phone"><img class="baom_free_phoneimg" src="http://s1.17house.com/newweb/m/newSem/1140/img/phone.png"/><input class="baom_free_phonetext" type="text" id="baom_phone" maxlength="11" placeholder="输入手机号，接收报价明细"/></div><div class="baom_free_btnbox"><p class="error-tip"></p><button class="baom_free_btn" id="sheji_shenqing">立即申请</button></div><div class="baom_free_fottext"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/dun.png"/> &nbsp;互联网装修上市企业 9年服务客户800万</div></div><!--右边--><div id="baom-budget_right"><h2>您的装修预算为 &nbsp;<span class="word_color">23246</span>&nbsp; 元</h2><div class="baom_budget_box"><ul><li>主材费：<span class="word_color">74568</span>元</li><li>施工费：<span class="word_color">44568</span>元</li><li>设计费：<span class="word_color">4568</span>元</li><li>施工费：<span class="word_color">1268</span>元</li></ul></div></div><!--关闭--><div id="baom_close"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/close.png"/></div></div>'
		$("#baom-sheji_wrapper").html(wrapperhtml);
		$("#baom-sheji_wrapper").css("display", "block");
		$("#sheji_shenqing").click(function() {
			var phone = $('#baom_phone');
			var areaname = $('#baom_area');
			var city = $('.baom_free_citylist');
			yuyueliangfangDesign.pop_baojia(ckname, phone, areaname, city,tit2,type)
		})
		//默认面积
		default_area()
		//随机人数
		apply_people()
		//关闭窗口
		yuyueliangfangDesign.close();
	});
}
//左边设计方案右边预算2
function popup_rbudget2(tit2) {
	var wrapperhtml = '<div id="baom-sheji" class="baoming"><!--左边--><div id="baom-sheji_left"><div class="sheji_left_head"><h2>完善信息获得 <span class="word_color">' + tit2 + '</span></h2><p class="word_min"><span class="word_color">*</span>由于当前申请人数较多，完善资料将得到优先服务</p></div><div class="sheji_left_content"><!--1--><div class="one"><h6 class="sheji_left_word">1.您家的房屋现状是：</h6><div class="sheji_left_houseradio"><div class="sheji_left_one"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_img1.jpg"/><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/><span>毛呸房</span></p></div><div class="sheji_left_one"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_img2.jpg"/><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/><span>旧房翻新</span></p></div> <div class="sheji_left_one"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_img3.jpg"/><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/><span>局邮改造</span></p></div></div></div><!--2--><div class="two"><h6 class="sheji_left_word">2.您家准备什么时候开始装修：</h6><div class="sheji_left_timeradio"><div class="sheji_left_two"><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/>一个月内</p></div><div class="sheji_left_two"><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/>两个月内</p></div><div class="sheji_left_two"><p><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio1.jpg" class="imgNoChecked"/><img src="http://s1.17house.com/newweb/m/newSem/1140/img/baom_radio2.jpg" class="imgChecked imgHide"/>两个月以上</p></div></div></div><div class="three"><h6 class="sheji_left_word">3.您家小区的名称：<input type="text" placeholder="一起装修网将为您推荐优秀服务"/></h6></div><button class="sheji_left_btn" id="sheji_tijiao">提交</button></div></div><!--右边--><div id="baom-budget_right1"><h2>您的装修预算为 &nbsp;<span class="word_color">23246</span>&nbsp; 元</h2><div class="baom_budget_box1"><ul><li>主材费：<span class="word_color">74568</span>元</li><li>施工费：<span class="word_color">44568</span>元</li><li>设计费：<span class="word_color">0</span>元 <del>4999元</del></li><li>施工费：<span class="word_color">0</span>元 <del>2690元</del></li></ul></div><p class="baom_budget_fottext"><span class="word_color">*报价有疑问？稍后装修管家将致电为您解答</span></p><p class="baom_budget_fottext">*该报价为整装全包价格，实际装修价格以量房实测为准</p></div><!--关闭--><div id="baom_close"><img src="http://s1.17house.com/newweb/m/newSem/1140/img/close.png"/></div></div>'
	$("#baom-sheji_wrapper").html(wrapperhtml);
	$("#baom-sheji_wrapper").css("display", "block");
	//报名提交
	$("#sheji_tijiao").click(function(){
		succeed()
	})
	//单选按钮
	radioimg();
	radiostart();

	//关闭窗口
	yuyueliangfangDesign.close();
}
//ip获取城市
function CityData(data) {
	var opt = '',
		cityflag = false,
		city = "";
	$.each(data.all, function(i, val) {
		var val = val.substring(0, val.length - 1);
		//		console.log(i,data.id)
		opt += '<option data-id="' + i + '" selected="selected">' + val + '</option>';

	});
	$.each(data.idall, function(i, val) {
		var val = val.substring(0, val.length - 1);
		if(i == data.id) {
			cityflag = true;
			city = val;
		} else {
			cityflag = false;
		}
	});
	opt += '<option value="其他">其他</option>';
	$(".baom_free_citylist").html(opt);
	if(!cityflag) {
		$(".baom_free_citylist").val(city);
	}
}
//获取城市
function citylists() {
	$.ajax({
		type: "GET",
		dataType: 'jsonp',
		jsonp: 'callback',
		url: "http://jia.17house.com/iphone/sorthotcity/",
		timeout: 0,
		contentType: "application/json;utf-8",
		success: function(data) {
//				console.log(data)
			if(data.err == 0) {
				CityData(data);
			}
		},
		error: function(data) {
			console.log(data);
		}
	});

}
//报名后提交

function succeed() {
		var name = $(".sheji_left_word input").val();
		var $data = JSON.parse(window.sessionStorage.getItem("baojiaArr"));
//		console.log(house);
//		console.log(start);
		//请选择您家的房屋现状
		if(house == ""){
			alert("请选择您家的房屋现状");
			return false;
		}
		if(start == ""){
			alert("请选择您家的装修时间");
			return false;
		}
		if(name == ""){
			alert("请输入您家小区名称");
			return false;
			
		}
		$data.newHouse = house;
		$data.zxdate = start;
		$data.community = name;
		$data.smsType = 0;
//		console.log($data.newHouse)
//		console.log($data.zxdate)
		$.ajax({
		        type: "GET",
		        dataType: 'jsonp',
		        jsonp: 'callback',
		        url: "http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?",
		        contentType: "application/json;utf-8",
		        data:$data,
		        success: function(data) {
//		        	console.log(data)
		        	if(data.error == 0){
		        		popup_rvideo3()
		        	}
		        }
		    });
		
};
//面积
default_area()
//城市列表
citylists();

//面积
function default_area() {
	$('.baom_free_areatext').val('70');
	$('.baom_free_areatext').focus(function() {
		$(this).val('');
		$(this).off();
	});
}

var house = "", start = "";
function radioimg() {
	for(let i = 0; i < $(".sheji_left_one").length; i++) {
		$(".sheji_left_one").eq(i).click(function() {
			let ind = $(this).index();
			$(this).find('.imgNoChecked').addClass('imgHide');
			$(this).siblings().find('.imgNoChecked').removeClass('imgHide');
			$(this).find('.imgChecked').removeClass('imgHide');
			$(this).siblings().find('.imgChecked').addClass('imgHide');
			house = $(".sheji_left_one").eq(ind).text();
//			console.log(house);
		})
	}
}

function radiostart() {
	for(let i = 0; i < $(".sheji_left_two").length; i++) {
		$(".sheji_left_two").eq(i).click(function() {
			let ind = $(this).index();
			$(this).find('.imgNoChecked').addClass('imgHide');
			$(this).siblings().find('.imgNoChecked').removeClass('imgHide');
			$(this).find('.imgChecked').removeClass('imgHide');
			$(this).siblings().find('.imgChecked').addClass('imgHide');
			start = $(".sheji_left_two").eq(ind).text();
//			console.log(start);
		})
	}
}
//随机数
function apply_people(){
	var suiji = Math.floor(Math.random()*(9999-4000+1)+4000);	
	suiji = suiji.toString();
	suiji = suiji.split("");
	$(".baom_free_apply span").each(function(i,n){
		$(".baom_free_apply span").eq(i).text(suiji[i]);
	})
}

var commonJS = {
		commonJSInit : function(){
			this.city();
		},
		phoneRegular : /^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/,
		//设置cookie
		setCookie:function(NameOfCookie, value, expiredays) {
			var ExpireDate = new Date();
			ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
			document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "": "; expires=" + ExpireDate.toGMTString());
		},
		//获取cookie值
		getCookie:function(NameOfCookie) {
			if (document.cookie.length > 0) {
					var begin = document.cookie.indexOf(NameOfCookie + "=");
					if (begin != -1) {
					begin += NameOfCookie.length + 1; 
					var end = document.cookie.indexOf(";", begin); 
					if (end == -1) end = document.cookie.length;
					return unescape(document.cookie.substring(begin, end));
				};
			};
			return null;
		},
		//删除cookie
		delCookie:function(NameOfCookie) {
			if(this.getCookie(NameOfCookie)) {
				document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
			};
		},
		//获取当前日期
		getNowFormatDate:function() {
	        var date = new Date();
	        var seperator1 = "-";
	        var year = date.getFullYear();
	        var month = date.getMonth() + 1;
	        var strDate = date.getDate();
	        
	        if (month >= 1 && month <= 9) {
	            month = "0" + month;
	        }
	        if (strDate >= 0 && strDate <= 9) {
	            strDate = "0" + strDate;
	        }
	        var currentdate = year + seperator1 + month + seperator1 + strDate;
	        return currentdate;
	    },
		 /*获取URL参数方法*/
		GetQueryString:function(arg){		
				  /*定义正则，用于获取相应参数*/
				  	var reg = new RegExp("(^|&)" + arg + "=([^&]*)(&|$)");
				  /*字符串截取，获取匹配参数值*/
				  	var r = window.location.search.substr(1).match(reg);
				  /*返回参数值*/
					  if (r != null){ 
					  	return decodeURI(r[2]);
					  }
					
				  return null;
		},
		CityData:"",
		//定位城市
        city:function(){
        	$.ajax({
		        type: "GET",
		        dataType: 'jsonp',
		        jsonp: 'callback',
		        url: "http://jia.17house.com/iphone/sorthotcity/",
		        timeout: 0,
		        contentType: "application/json;utf-8",
		        success: function(data) {
		        	if(data.err==0){
		        		commonJS.CityData=data;
						if(data.id==2){
							$("input[name=square]").val(70);
						    $("input[name=area]").val(70);
						}else if(data.id==800){
							$("input[name=square]").val(50);	
							$("input[name=area]").val(50);
						}else {
							$("input[name=square]").val(90);
							$("input[name=area]").val(90);
						}		        		
		        		
		        	}
		        }
		    });
        },
        //公用ajax
        ajax:function(url,data,fn){
        	$.ajax({
		        type: "GET",
		        dataType: 'jsonp',
		        jsonp: 'callback',
		        url: url,
		        contentType: "application/json;utf-8",
		        data:data,
		        success: function(data) {
		        	fn(data)
		        }
		    });
        },
        /* 表单输入框获取焦点、失去焦点 */
        focusBlur: function(ele) {
            function trimCode(s) {
                s = $.trim(s);
                s = s.replace(/ /g, '');
                s = s.replace(/\t/g, '');
                s = s.replace(/\r/g, '');
                s = s.replace(/\n/g, '');
                return s;
            }
            for (var i = 0; i < ele.length; i++) {
                var _e = $(ele[i]);
                //取当前值，并替换掉两端空格、替换掉回车符， 检查是否和 data-value 属性的默认值 相同。
                var _val = trimCode(_e.val());
                if (_val == '') {
                    _e.val(_e.attr('data-value')); //初始化
                }
                _e.focus(function() {
                    var _val = $.trim($(this).val());
                    if ($(this).attr('data-value') == _val) {
                        $(this).val('');
                    }
                }).blur(function() {
                    var _val = $.trim($(this).val());
                    var _attrVal = $(this).attr('data-value');
                    if (_val == '') {
                        $(this).val(_attrVal);
                    }
                });
            }
        },
        /*文字滚动start*/
		Roll_txt:function(Scroll_txt){
			var bobao=Scroll_txt;
			function animator(currentItem) {
				if($(".xidi").css("display")=="none"||$(".Roll_txt").css("display")=="none"){
					return false;
				};
				//work out new anim duration
				var distance = currentItem.height();
				duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;
		
				//animate the first child of the bobao
				currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
		
					//move current item to the bottom
					currentItem.appendTo(currentItem.parent()).css("marginTop", 0);
		
					//recurse
					animator(currentItem.parent().children(":first"));
				});
		    };
		    //start the bobao
			animator(bobao.children(":first"));
		
			//set mouseenter
			bobao.mouseenter(function() {
		
				//stop current animation
				bobao.children().stop();
		
			});
		
			//set mouseleave
			bobao.mouseleave(function() {
		
				//resume animation
				animator(bobao.children(":first"));
		
			});
		},
		/*文字滚动end*/
		/*报名量滚动*/
		Quota:{
		   getnum: function(from, to) {
		      var _hour = new Date().getHours(),
		         _syNum = 144;
		      var fff = 0;
		      if(new Date().getMinutes() >= 50) {
		         fff = 1;
		      } else if(new Date().getMinutes() >= 40) {
		         fff = 2;
		      } else if(new Date().getMinutes() >= 30) {
		         fff = 3;
		      } else if(new Date().getMinutes() >= 20) {
		         fff = 4;
		      } else if(new Date().getMinutes() >= 10) {
		         fff = 5;
		      } else if(new Date().getMinutes() < 10) {
		         fff = 6;
		      };
		      var hhh = _hour * 6
		      _syNum = 144 - (hhh + fff);
		      return _syNum;
		   },
		   countDown: function(box, from, to) {
		      var item1 = box.eq(0);
		      var item2 = box.eq(1);
		      var item3 = box.eq(2);
		      var item4 = box.eq(3)
		      function design_quota() {
		         if(from >= to) {
		            render(from -= 140);
		            if(from <= to) {
		               render(to);
		            }
		            setTimeout(design_quota, 10);
		         }
		      }
		      function render(num) {
		      	if(num>1000){
		      		 var num1 = Math.floor(num / 1000);
			         var num2 = Math.floor(num / 100 % 10);
			         var num3 = Math.floor(num /10 % 10);
			         var num4 = Math.floor(num%10);
			         item1.html(num1)
			         item2.html(num2)
			         item3.html(num3)
			         item4.html(num4)
		      	}else if(num>100){
		      		 var num1 = Math.floor(num / 100);
			         var num2 = Math.floor(num / 10 % 10);
			         var num3 = Math.floor(num % 10);
			         item1.html(num1)
			         item2.html(num2)
			         item3.html(num3)
		      	}else if(num>10){
		      		 var num1 = Math.floor(num / 10);
			         var num2 = Math.floor(num % 10);
			         item1.html(num1)
			         item2.html(num2)

		      	}
		        
		      }
		      design_quota();
		   }
		},
		/*报名量滚动end*/	
		//获取前面的www或beijing等
		urlA: function() {　　　　
			var url = document.location.hostname.toString();　　　　
			var arrUrl = url.split(".");
			var start = arrUrl[0];　　　　　　　　
			return start;　　
		},
		urlB: function() {
			var url = document.location.pathname.toString();
			var arrUrl = url.split("/");
			var start = arrUrl[1];
			return start;　　
		},
		//参数说明: ele1是省(jquery对象)，ele2是市(jquery对象)
        //GP是省，GC1是市（GP和GC1 来源于 http://news.17house.com/source/plugin/znbj/template/znbj-static/provinces.js ）
        init: function(ele1, ele2, GP, GC1) {
            var html = ' ';
            var len = GP.length;
            for (var i = 0; i < len; i++) {
                html += '<option value="' + GP[i] + '">' + GP[i] + '</option>';
            }
            ele1.html(html);
            ele1.bind("change", function() {
                var html = '';
                var key = $(this).val();
                var len = GC1[key].length;
                for (var i = 0; i < len; i++) {
                    html += '<option value="' + GC1[key][i] + '">' + GC1[key][i] + '</option>';
                }
                ele2.html(html);
                //$(this).parents('form').find('select[name=User_City]').html(html);
            });

        },
		/*根据cookie城市值，获取省份*/
        getProvince: function(tempCity){
            $.each(GP,function(index,province){
                $.each(GC1[province],function(idx,city){
                    if(tempCity == city){
                        $("select[name=User_Shen]").val(province);
                    }
                });
            });
        },
         /*检查姓名*/
        checkName: function(name,errorH) {
            var $value = name.val();
            if ($value=="" || $value == name.attr('data-value')) {
                errorH.html('请填写姓名');
                name.focus();
                return false;
            }
            return true;
        },
        /*检查面积*/
        checkArea: function(ele, errorH) {
            var $value = ele.val();
            if ($value=="" || $value == ele.attr('data-value')) {
               	errorH.html('请填写面积');
                ele.focus();
                return false;
            }
             var regTest = /[0-9]$/;
            if (!regTest.test($value)) {
                errorH.html('建筑面积: 请填写数字');
                ele.focus();
                return false;
            }
            var regTest = /^(?:[0-9]{1,3}|1000)$/;
			if(!regTest.test($value)){
				errorH.html('房屋面积需为小于1000的数字');
				ele.focus();
				return false;
			}
            return true;
        },
         /*检查手机号*/
        checkPhone: function(mobile,errorH) {
            var mobileNum = mobile.val();
            if (mobileNum == '' || mobileNum == mobile.attr('data-value')) {
               	errorH.html('请填写手机号');
                mobile.focus();
                return false;
            }
            var regTest =commonJS.phoneRegular;
            if (!regTest.test(mobileNum)) {
                errorH.html('电话格式不对，请检查');
                mobile.focus();
                return false;
            }
            return true;
        },
        /*验证城市*/
        checkCity: function(City,errorH){
            if (City == '' || City == '选择您房屋所在城市') {
                errorH.html('请选择城市');
                return false;
            }
            return true;
        },
	};

    var window_box = function(){
    	var suipingBox = {    		
    		pushHtml:function(){
    			var newTime = new Date();
    			var m = newTime.getMonth() + 1;
    			var oneMonth="",twoMonth="",threeMonth="";
    			switch (m){
    				case 12:
	    				oneMonth=(newTime.getFullYear()+1)+"年"+"1月1日";
	    				twoMonth=(newTime.getFullYear()+1)+"年"+"2月1日";
	    				threeMonth=(newTime.getFullYear()+1)+"年"+"3月1日";
    					break;
    				case 11:
	    				oneMonth=(newTime.getFullYear())+"年"+"12月1日";
	    				twoMonth=(newTime.getFullYear()+1)+"年"+"1月1日";
	    				threeMonth=(newTime.getFullYear()+1)+"年"+"2月1日";
    					break;
    				case 10:
	    				oneMonth=(newTime.getFullYear())+"年"+"11月1日";
	    				twoMonth=(newTime.getFullYear())+"年"+"12月1日";
	    				threeMonth=(newTime.getFullYear()+1)+"年"+"1月1日";
    					break;
    				default:
    					oneMonth=(newTime.getFullYear())+"年"+(m+1)+"月1日";
	    				twoMonth=(newTime.getFullYear())+"年"+(m+2)+"月1日";
	    				threeMonth=(newTime.getFullYear())+"年"+(m+3)+"月1日";
    					break;
    			};
    			var baoHtml = '<div class="suiping clearfix">\
					<div class="wbox-close"><img src="http://s1.17house.com/common_h5/redpacket/images/close.png"></div>\
					<div class="suipingBox">\
						<div class="slide-box-shade"></div>\
						<div class="suiping-box-banner"><img class="jz-ok2" src="http://s1.17house.com/newweb/pc/common/images/jz-ok5.png" alt="">\
							<div class="suiping-jt jiantouUp" data-tf="true"><img src="http://s1.17house.com/newweb/pc/common/images/xidi-jantouUP1.png" alt=""></div>\
						</div>\
					</div>\
					<div class="suiping-box">\
						<div class="wbox clearfix">\
							<div class="wbox-form">\
								<h3 class="wbox-form-title">装修计算器<span class="wRoll-title">今日已有<span>0</span>位业主获取了装修预算</span></h3>\
								<form method="post" action="" class="calc-form">\
									<dl class="ipt-line clearfix">\
										<dt>所在城市:<em class="label_start">*</em></dt>\
										<dd class="js-area-btn">\
    				                        <span class="inpIcon cityIcon"></span>\
											<select name="city" class="ipt">\
											</select>\
										</dd>\
									</dl>\
									<dl class="ipt-line mt14 clearfix">\
										<dt>房屋面积:<em class="label_start">*</em></dt>\
										<dd>\
    				                        <span class="inpIcon areaIcon"></span>\
											<input type="text" name="area"  placeholder="输入您的房屋面积" data-value="输入您的房屋面积" autocomplete="off" class="ipt" maxlength="3">\
											<span class="abs-pingmi">㎡</span>\
										</dd>\
									</dl>\
									<dl class="ipt-line mt14 clearfix">\
										<dt>手机号码 :<em class="label_start">*</em></dt>\
										<dd>\
    				                        <span class="inpIcon phoneIcon"></span>\
											<input type="text" name="phone" value="" data-value="输入手机号,报价明细将发送到手机上" autocomplete="off" class="ipt" maxlength="11">\
										</dd>\
									</dl>\
									<dl class="ipt-line mt10 clearfix"><dt></dt>\
										<dd class="error-tip"></dd>\
									</dl>\
								</form>\
							</div>\
							<div class="wbox-btn">\
								<div class="btnbox">\
									<p>开始计算</p>\
								</div>\
							</div>\
							<div class="wbox-result">\
								<div class="res-con">\
									<p class="res-table-title">您的装修预算约为 <span class="f28 fB cOrange" id="base_all">105765</span> 元</p>\
									<div class="res-list">\
										<ul class="res-list-before clearfix">\
											<li class="res-lbj clearfix"><span>主材费：</span><strong id="materialPay"><em>0</em>元</strong></li>\
											<li class="res-lbj clearfix"><span>施工费：</span><strong id="artificialPay"><em>0</em>元</strong></li>\
											<li class="res-rbj clearfix"><span>设计费：</span><strong id="designPay"><em>0</em>元</strong><del>4999元</del></li>\
											<li class="res-rbj clearfix"><span>质检费：</span><strong id="qualityPay"><em>0</em>元</strong><del>2690元</del></li>\
										</ul>\
									</div>\
									<div class="hotad-bjtext">\
										<p class="cOrange"><b>*</b>报价有疑问？稍后装修管家将致电为您解答</p>\
										<p class="cGGray"><b>*</b>该报价为整装全包价格，实际装修报价以量房实测为准</p>\
									</div>\
								</div>\
							</div>\
							<div class="wbox-check">\
								<h3>完善以下信息<span>&nbsp;&nbsp;&nbsp;让我们更了解您的需求优先为您服务</span></h3>\
								<div class="house-type clearfix">\
									<p class="check_question">1.&nbsp;您家的房屋现状是 :</p>\
									<div class="check-house" data-ptag="0">\
										<div class="new-house"></div>\
										<p><i></i>毛坯房</p><input type="hidden" value="毛坯房">\
									</div>\
									<div class="check-house" data-ptag="1">\
										<div class="old-house"></div>\
										<p><i></i>旧房翻新</p><input type="hidden" value="旧房翻新">\
									</div>\
									<div class="check-house check-house-last" data-ptag="2">\
										<div class="little-change"></div>\
										<p><i></i>局部改造</p><input type="hidden" value="局部改造">\
									</div>\
								</div>\
								<div class="decorate-time clearfix">\
									<p class="check_question">2.&nbsp;您家准备什么时候开始装修 :</p>\
									<div class="check-time" data-ptag="1" data-time="'+oneMonth+'">\
										<p><i></i>一个月内</p><input type="hidden" value="1个月内">\
									</div>\
									<div class="check-time check-time-next" data-ptag="2" data-time="'+twoMonth+'">\
										<p><i></i>两个月内</p><input type="hidden" value="2个月内">\
									</div>\
									<div class="check-time check-time-next" data-ptag="3" data-time="'+threeMonth+'">\
										<p><i></i>两个月以上</p><input type="hidden" value="2个月以上">\
									</div>\
								</div>\
								<div class="plot-name clearfix">\
									<p class="check_question">3.&nbsp;您家小区名称 :&nbsp;&nbsp;</p>\
									<input type="text" placeholder="一起装修网将为您推荐优质服务" maxlength="24" style="border-color: rgb(221, 221, 221);">\
								</div>\
								<a href="javascript:void(0);" class="check-upload">提交</a>\
								<div class="complate-form">\
									<p></p>\
								</div>\
							</div>\
						</div>\
					</div>\
				</div>';
				var popSucceed = '<div class="pop-succeed">\
					<div class="pop-succeed-box stepEnd clearfix">\
						<div class="l tender-popac-left ">\
                            <div class="stepEndLeft stepEndItem">\
                                <div class="sucessWarp"><img src="//s1.17house.com/newweb/m/newSem/1138/images/success.png"></div>\
                                <div class="sucessTit">申请成功！</div>\
                                <div class="leftCon">\
	                                <div class="stepEndHint"><span>*</span>15分钟后装修管家将以手机回电，为您提供免费咨询，敬请留意</div>\
	                                <div class="stepEndHint"><span>*</span>一起装修网提供免费量房-0元设计及VR实景方案-免费详细报价服务</div>\
	                            </div>\
	                        </div>\
                        </div>\
						<div class="l tender-popac-right">\
						    <div class="stepEndRight stepEndItem">\
						        <div class="rightCon">\
						            <div class="videoWarp">\
						                <img class="videoPop" src="//s1.17house.com/newweb/m/newSem/1141/images/success/video-img.png">\
						                <video id="myvideo1" controls="" class="video-js vjs-big-play-centered" >\
						                    <source src="//static-default.17house.com/17housevedio/17housevedio.mp4" type="video/mp4">\
						                </video>\
						            </div>\
						            <div class="companyTit">公司介绍</div>\
						            <div class="companyIntro">全国一站式装修服务平台，70%以上的客户来自口碑介绍，中国建筑装饰协会住宅委员会指定最具信赖的装修平台。目前已经在17个城市开设分公司和体验店。2017年2月挂牌新三板。</div>\
						            <div class="inatroList clearfix">\
						                <dl>\
						                    <dt class="tl">2009年</dt>\
						                    <dd class="tl">成立时间</dd>\
						                </dl>\
						                <dl>\
						                    <dt>中国北京</dt>\
						                    <dd>成立地点</dd>\
						                </dl>\
						                <dl>\
						                    <dt>家装服务</dt>\
						                    <dd>主营业务</dd>\
						                </dl>\
						                <dl>\
						                    <dt>120W人</dt>\
						                    <dd>正在访问</dd>\
						                </dl>\
						                <dl class="hideBorder">\
						                    <dt>800W人</dt>\
						                    <dd>累计服务</dd>\
						                </dl>\
						            </div>\
						        </div>\
							</div>\
						</div>\
					</div>\
					<span class="popup-close"></span>\
				</div>';
				$("body").append(baoHtml+popSucceed);
				commonJS.focusBlur($(".suiping-box input[name=area]"));
				commonJS.focusBlur($(".suiping-box input[name=phone]"))
    		},
    		//随机0-20万的数字
    		randomNumber:function(){
	            var self = this;
	            self.randomFun = setInterval(function(){
	                $('#base_all').text(Math.ceil(Math.random()*190000)+10000);
	                $('#materialPay em').text( Math.floor(10000 + Math.random() * (99999-10000+1)));
	                $('#artificialPay em').text( Math.floor(10000 + Math.random() * (99999-10000+1)));
	                $('#designPay em').text(Math.floor(1000 + Math.random() * (10000-1000+1)));
	                $('#qualityPay em').text(Math.floor(500 + Math.random() * (5000-500+1)));
	            },200);   
    		},
    		//获取城市列表
    		bottomCity:function(){
    			function CityData(data){
		    		var html='',cityflag=false;
	        		$.each(data.all, function(i,val) {
	        			var val=val.substring(0,val.length-1);
	        			if(i==data.id){
	        				html+='<option data-id="'+i+'" selected="selected">'+val+'</option>';
	        				cityflag=true;
	        			}else{
	        				html+='<option data-id="'+i+'">'+val+'</option>';
	        			}
	        		});
	        		html+='<option data-id="0">其它</option>';
	        		$(".js-area-btn .ipt").html('').html(html);
	        		if(!cityflag){
	        			$(".js-area-btn .ipt").val("北京");
	        		}
					if(data.id==2){
						$("input[name=square]").val(70);
					    $("input[name=area]").val(70);
					}else if(data.id==800){
						$("input[name=square]").val(50);	
						$("input[name=area]").val(50);
					}else {
						$("input[name=square]").val(90);
						$("input[name=area]").val(90);
					}		        		
	        		
		    	};
    			if(commonJS.CityData){
					CityData(commonJS.CityData);
				}else{
					$.ajax({
				        type: "GET",
				        dataType: 'jsonp',
				        jsonp: 'callback',
				        url: "http://jia.17house.com/iphone/sorthotcity/",
				        timeout: 0,
				        contentType: "application/json;utf-8",
				        success: function(data) {
				        	if(data.err==0){
				        		CityData(data);				        		
				        	}
				        },
				        error:function(data){
				        	console.log(data);
				        }
				    });
				}
    		},
    		jiantouUp:function(){
    			var _this = this;
		        $('.jiantouUp').stop().animate({top:'20px'},500,function(){
		            _this.jiantouUp();    
		        });
			    if ($('.jiantouUp').css('top') == '20px') {
			        $('.jiantouUp').stop().animate({top:'0'},500,function(){
			            _this.jiantouUp();    
			        });
			    };    
			},
    		//随屏展开
    		autoOpen:function(){
    			var _this = this;
		   		$(window).scroll(function(){ 
		   			if(_this.autoOpenIf){
		   				return false;
		   			};
			        _this.now_scr =$(window).scrollTop();
			        if ((_this.now_scr+$(window).height()-_this.slide_height_current) > 0) {
			            if ((parseInt($('.suiping').css('bottom'))+(_this.now_scr - _this.front_scr)) <-360) {
			                _this.front_scr = $(window).scrollTop();
			                $('.suiping').css('bottom','-360px');
			                 $(".suiping-jt").attr({
								'data-tf':"true"
							});	
							_this.jiantouUp();
							$(".suiping-jt").find("img").attr({
								"src":"http://s1.17house.com/newweb/pc/common/images/xidi-jantouUP1.png"
							})
			                return;  
			            }
			            //浮框定位bottom > 0
			            if ((parseInt($('.suiping').css('bottom'))+(_this.now_scr - _this.front_scr)) > 0) {
			                _this.front_scr = $(window).scrollTop();
			                $('.suiping').css('bottom','0');
			               $(".suiping-jt").attr({
								'data-tf':"false"
							});	
							$(".jiantouUp").stop();
							$(".suiping-jt").find("img").attr({				
								"src":"http://s1.17house.com/newweb/pc/common/images/xidi-jantouDown1.png"
							})
			                return;
			            };
			            if (_this.now_scr - _this.front_scr > 0) {
			                $('.suiping').css('bottom',(parseInt($('.suiping').css('bottom'))+(_this.now_scr - _this.front_scr))+'px');
			                _this.front_scr = $(window).scrollTop();                    
			            }else{
			                $('.suiping').css('bottom',(parseInt($('.suiping').css('bottom'))+(_this.now_scr - _this.front_scr))+'px');
			                _this.front_scr = $(window).scrollTop();
			            }
			        }else{            
			            _this.front_scr = $(window).scrollTop();
			            $('.suiping').css('bottom','-360px');
			            $(".suiping-jt").attr({
							'data-tf':"true"
						});
	//					$(".jiantouUp").stop();
						$(".suiping-jt").find("img").attr({
							"src":"http://s1.17house.com/newweb/pc/common/images/xidi-jantouUP1.png"
						})
			            return; 
			        }
			    }); 
	   		},
	   		//click展开 关闭
	   		clickOpen:function(){
	   			var _this = this;
	   			$(".suiping-box-banner").on("click",function(){
					if($(".suiping-jt").attr("data-tf")== "true"){
						$(".suiping").stop(false,true).animate({
							bottom:"0px"
						},400,function(){
							$(".suiping-jt").attr({
								'data-tf':"false"
							});	
							$(".suiping-jt").find("img").attr({				
								"src":"http://s1.17house.com/newweb/pc/common/images/xidi-jantouDown1.png"
							});
							$(".jiantouUp").stop();
							$(".suiping-jt").removeClass("jiantouUp");
							$(".suiping-jt").css({
								top:"10px"
							});
						})
						return false;
					};
					$(".suiping").stop(false,true).animate({
						bottom:"-360px"
					},400,function(){
						_this.autoOpenIf=true;
						$(".suiping-jt").attr({
							'data-tf':"true"
						});
						$(".suiping-jt").find("img").attr({
							"src":"http://s1.17house.com/newweb/pc/common/images/xidi-jantouUP1.png"
						});
						$(".suiping-jt").addClass("jiantouUp");
						 _this.jiantouUp();
						 uup=true;
					});
				});
				$(".wbox-close").on("click",function(){
					$(".suiping").stop(false,true).animate({bottom:"-480px"},400,function(){$(".suiping").height(0).css("overflow","hidden");});
				})
	   		},
	   		//表单提交
	   		formSubmit:function(){
	   			var _this = this;
				$('.suiping-box .btnbox').click(function(){	
					$('.suiping-box .error-tip').html("");
					var _form = $('.suiping-box .calc-form');
					var _phone = _form.find('input[name=phone]');
					var _area = _form.find('input[name=area]');
					var _city = _form.find('select[name=city]');
					if(!commonJS.checkArea(_area,_form.find('.error-tip'))){
						return false;
					};
					if(!commonJS.checkPhone(_phone,_form.find('.error-tip'))){
						return false;
					};	
//					
//					//三个channel的赋值
//					var rFirst=commonJS.getCookie("userMail") || document.referrer,
//						rSecond=window.location.href;/*落地页*/
//				    var Fsurl = /semzengbin\=/;
//				    var XmtUrl=/xmt\=/;
//				    var ModelUrl = /model\=/;
//				    var cF="站内";
//					var cS="pc-bottom";
//					var cK="智能报价-底部随屏";	  
//			        //判断sem或者新媒体
//			        if(Fsurl.test(rSecond)){
//			        	cF="sem";
//			        }else if(XmtUrl.test(rSecond)){
//						cF="新媒体";
//						var ArrXmt=commonJS.GetQueryString("xmt")
//						var ArrFirst=[["weixin","微信公众号"],["weixin-caidan","公众号菜单"],["weixin-guanggao","公众号广告"],["weixin-guanzhu","公众号关注"],["weixin-fuwu","公众号服务"],["weixin-wangye","公众号网页"],["weibo","微博"],["weibo-caidan","微博菜单"],["weibo-huodong","微博活动"],["weibo-zixun","微博咨询"],["zimeit","自媒体"],["zimeit-lianjie","自媒体链接"],["BD","渠道合作"],["qq","QQ群"],["gerenweixin","个人微信"],["huodong","活动"],["qita","其他"]];
//						for(var i=0;i<ArrFirst.length;i++){
//						    	if(ArrXmt==ArrFirst[i][0]){
//						    	 cS=ArrFirst[i][1]+"-pc";
//						    	}
//						    }
//					}else if(ModelUrl.test(rSecond)){
//							cF="app";
//							var ArrModel=commonJS.GetQueryString("model")
//							cS = ArrModel;
//						};
						
						
					/*获取URL参数方法*/
		var GetQueryString = function(arg) {
			/*定义正则，用于获取相应参数*/
			var reg = new RegExp("(^|&)" + arg + "=([^&]*)(&|$)");
			/*字符串截取，获取匹配参数值*/
			var r = window.location.search.substr(1).match(reg);
			/*返回参数值*/
			if(r != null) {
				return decodeURI(r[2]);
			}

			return null;
		};
		var $data = {},
			cF = "SEM",
			her = location.href,
			cy = /shanghai/,
			cS = $("#position").val(),
			GJ = "baom-装修预算",		//'获取报价-' + $("#position_name").val(),
			da = "baom-装修预算"; 		/*sacfsf*/
		var semZhi = GetQueryString("channel");
		switch(semZhi) {
			case "sembaidu":
				cS = "百度-PC";
				break;
			case "semsougou":
				cS = "搜狗-PC";
				break;
			case "sem360":
				cS = "360-PC";
				break;
			case "semsm":
				cS = "神马-PC";
				break;
			case "semdsp":
				cS = "DSP-PC";
				break;
		};
		$data.mobile = _phone.val();
		$data.name = "匿名";
		$data.cityName = _city.val();
		$data.referrerSecond = document.location.href;
		$data.referrerFirst = yuyueliangfangDesign.gC('userMail') || document.referrer;
		$data.smsType = "3";
		$data.zxdate = "",
		$data.square = _area.val(),
		$data.community = "";
		if(cy.test(her)) {
			da = "SEM上海-" + GJ;
		}
		$data.channelFirst = cF;
		$data.channelSecond = cS;
		$data.channelKey = "baom-装修预算";
		$data.semId = semId;
		window.sessionStorage.setItem("baojiaArr",JSON.stringify($data));
		var urlreferer = document.referrer || window.location.href;
		var urlReg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
		var refurl = urlReg.exec(urlreferer);
		var urldomain = refurl[0];
		var userinfo = encodeURIComponent(da) + "---" + encodeURIComponent('城市：') + _city.val() + '---' +
			encodeURIComponent('手机号码：') + _phone.val() + '---' + encodeURIComponent('面积：') + _area.val(); //这里需要拼上用户填写报名的手机和用户名
		var staturl = 'http://stat.17house.com/stat.js?site=pc&housetype=jzsem&houseyewu=baoming&urlreferer=' +
			urlreferer + '&userinfo=' + userinfo + '&urldomain=' + urldomain + '&t=' + new Date().getTime();
		$.get(staturl);	
		 var $fn = function(data){			        					
						$('#base_all').html(parseInt(data.data.jianzhuang.total_price));//装修预算
						$('#materialPay em').html(parseInt(data.data.jianzhuang.total_price-data.data.jianzhuang.half_price));//主材费
						$('#artificialPay em').html(parseInt(data.data.jianzhuang.half_price));//施工费
						$('#designPay em').html("0");//设计费
						$('#qualityPay em').html("0");//质检费
						$(".suiping-box .res-rbj del,.suiping-box .hotad-bjtext,.suiping-box .wbox-check").show();
						$(".wbox-form,.wbox-btn").hide();
						_this.succeedSubmit();
			        };
			        commonJS.ajax('http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?',$data,$fn);
		
				
						
						
//						
//			        var Type = "3";
//			        var Name = "匿名";
//			        /*新增数据监测*/
//			       	var $firsturl=commonJS.getCookie("userMail")|| document.referrer;
//					var $secondurl=window.location.href;
//					var Fsurl = /semzengbin\=/;
//			        var urlreferer = document.referrer || window.location.href;
//			        var urlReg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
//			        var refurl = urlReg.exec(urlreferer);
//			        var urldomain = refurl[0];
//			        var userinfo=cK+'---一级渠道：'+cF+'---二级渠道：'+cS+'---城市：'+_city.val()+'---手机号码：'+_phone.val()+'---面积：'+_area.val();
//			 			userinfo = encodeURIComponent(userinfo);
//			        var staturl = 'http://stat.17house.com/stat.js?site=17houseadvert&brower_type=pc&ltype=baoming&stype=智能报价-底部随屏&tag_index=0&tag_name=' + encodeURIComponent('智能报价-底部随屏') + '&urlreferer="' + urlreferer + '"&userinfo="' + userinfo + '"&urldomain="' + urldomain + '"&t=' + new Date().getTime();
//			        if(commonJS.getCookie("userMail") || Fsurl.test($secondurl)) {
//			           staturl = 'http://stat.17house.com/stat.js?site=pc&housetype=jzsem&houseyewu=baoming&urlreferer=' + $firsturl + '&userinfo=' + userinfo + '&urldomain=' + urldomain + '&t=' + new Date().getTime();
//			        };
//			        $.getScript(staturl);
//			        clearTimeout(_this.randomFun);
//			        var $data = {
//			        	name:Name, 
//			        	mobile:_phone.val(), 
//			        	channelFirst:cF,
//			        	channelSecond:cS,
//			        	channelKey:cK,
//			        	cityName:_city.val(),
//			        	zxdate:"",
//			        	square:_area.val(), 
//			        	community:"",
//			        	smsType:Type,
//			        	referrerFirst:$firsturl,
//			        	referrerSecond:$secondurl
//			        };
//			        window.sessionStorage.setItem("baojiaArr",JSON.stringify($data));
//			       

				});
	   		},
	   		
	   		//报名后提交
	   		succeedSubmit:function(){
	   			var houseType = "";
	   			var houseTime = "";
	   			var $data = JSON.parse(window.sessionStorage.getItem("baojiaArr"));
	   			$(".wbox-check .check-house").off().click(function(){
	   				$(this).addClass("on").siblings().removeClass("on");
	   				houseType=$(this).attr("data-ptag");
	   			});
	   			$(".wbox-check .check-time").off().click(function(){
	   				$(this).addClass("on").siblings().removeClass("on");
	   				houseTime=$(this).attr("data-time");
	   			});
	   			$(".wbox-check .check-upload").off().click(function(){
	   				var houseName = $('.wbox-check .plot-name').find("input").val();
	   				if(houseType==""){
	   					$(".complate-form").html("请选择您家的房屋现状").show();
	   					setTimeout(function(){
	   						$(".complate-form").html("").hide();
	   					},1500);
	   					return false;	
	   				};
	   				if(houseTime==""){
	   					$(".complate-form").html("请选择您家的装修时间").show();
	   					setTimeout(function(){
	   						$(".complate-form").html("").hide();
	   					},1500);
	   					return false;	
	   				};
	   				if(houseName==""){
	   					$(".complate-form").html("请输入您家小区名称").show();
	   					setTimeout(function(){
	   						$(".complate-form").html("").hide();
	   					},1500);
	   					return false;	
	   				};
	   				if(houseType==2){
	   					$data.msg="局部改造";
	   					$data.newHouse="";
	   				}else{
	   					$data.newHouse=houseType;
	   				};
	   				$data.zxdate=houseTime;
	   				$data.community=houseName;
	   				$data.smsType=0;
					var $fn = function(data){
						bgColorUp();
	   					$(".pop-succeed").show();
	   					$("html,body").css("overflow-y","hidden");
						$(".pop-succeed .popup-close").off().click(function(){
							bgColorDown();
	   						$(".pop-succeed").hide();
	   						$("html,body").css("overflow-y","scroll");
	   					    var myvideo1 = document.getElementById("myvideo1");
	   					    var myvideo2 = document.getElementById("myvideo2");
	   				 	    var myvideo3 = document.getElementById("myvideo3");
		                    if(myvideo1){
		                    	$(".videoPop").show();
			                    myvideo1.pause();
		                    }
		                    if(myvideo2){
		                    	$(".videoPop").show();
			                    myvideo2.pause();
		                    }
		                    if(myvideo3){
		                    	$(".videoPop").show();
			                    myvideo3.pause();
		                    }
						});
					};
					commonJS.ajax('http://appapi.17house.com/ZnbjApi.php?action=znbjCalculatorNew&callback=?',$data,$fn);
	   			});
	   		},
	   		//初始化
	   		init:function(){
    			this.pushHtml();
    			this.randomNumber();
    			this.bottomCity();
    			this.jiantouUp();
    			this.autoOpenIf=false;
    			this.front_scr = 0;//前一个滚动条距离
			    this.now_scr = 0;//现在的滚动条距离
			    this.slide_height_current = 1500;
    			var followSlide = /\/zixun|\/ask|\/biaoqian/;
    			if(followSlide.test(window.location.href)){this.autoOpen();};
    			this.clickOpen();
    			this.formSubmit();
    			var _syNum=78;
			    (function(){  
			    	// 凌晨0点--23点  每个小时随机增加0-150名报名数
			    	var _hour = new Date().getHours();
			    	if(_hour == 0){
			                _syNum = 78;
			           }else if(_hour > 0 && _hour < 24){
			                _syNum =(_hour*100 + (new Date().getMinutes())*3 );
			            }
			    		$(".suiping-box .wRoll-title").find("span").html(_syNum);
			    	setTimeout(function(){ 
			    		setT();
			    	},3600000);  	
			    	
			    })();
    		}
    	};
    	suipingBox.init();
	
};
var bgColorUp = function(){		
				var maskLayer = '<div class="maskLayer"></div>';
				$("body").append(maskLayer);
				var bh = $("body").height();
				var bw = $("body").width();
				$(".maskLayer").css({
					"position":"fixed",
					"top":"0",
					"left":"0",
					"background":"#000",
					"height": bh,
					"width": bw,
					"opacity":"0.6",
					"filter":"alpha(opacity:60)",
					"z-index":"9999"		
				});
		
			};
			/* 弹窗遮罩隐藏*/
			var bgColorDown= function () {
				$(".maskLayer").remove();
			};
	if(!($(".window_box").length)&&location.href.indexOf("1139")>=0){
		window_box();	
	}




/* 中装协评定轮播图 */
var now = 0;
jQuery('.honor_left').click(function() {
	now--;
	if(now == -1) {
		now = jQuery('.honors').length - 1;
	}
	tab();
});
jQuery('.honor_right').click(function() {
	now++;
	if(now == jQuery('.honors').length) {
		now = 0;
	}
	tab();
});

function tab() {
	jQuery('.honor_list').stop().animate({
		'left': -now * jQuery('.honors').eq(0).width() + 'px'
	});
}

setInterval(function() {
	now++;
	if(now == jQuery('.honors').length) {
		now = 0;
	}
	tab();
}, 3000);

/* 中装协评定左右按钮显示隐藏 */
$('.honor').hover(function() {
	$('.honor_left i').css('display', 'inline-block');
	$('.honor_right i').css('display', 'inline-block');
}, function() {
	$('.honor_left i').css('display', 'none');
	$('.honor_right i').css('display', 'none');
});
//$(function(){
//	$("#btn").click(function(){
//		console.log(LLForm)
//	})
//})